using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using com.paypal.soap.api;
using IGlobalist.Cms.Common;

namespace IGlobalist.Cms
{
    public partial class TestPayment : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                PaymentPro.SetProfilePaypalInfo();
            }
        }


        public override void DataBind()
        {
            if (this.TransactionID != null)
            {
                PayPalAPI api = new PayPalAPI();
                this.PayPalResponse = api.GetTransactionDetails(this.TransactionID);
            }
            base.DataBind();
        }


        protected void PayButton_Click(object sender, EventArgs e)
        {
            PayPalAPI api = new PayPalAPI();
            int expMonth = int.Parse(this.expDateMonth.SelectedValue);
            int expYear = int.Parse(this.expDateYear.SelectedValue);
            this.PayPalResponse = api.DoDirectPayment(
                this.amount.Value,
                this.txtFirstName.Value,
                this.txtLastName.Value,
                this.address1.Value,
                this.address2.Value,
                this.city.Value,
                this.state.Value,
                this.zip.Value,
                this.creditCardType.SelectedValue,
                this.creditCardNumber.Value,
                this.cvv2Number.Value,
                expMonth,
                expYear, PaymentActionCodeType.Authorization);
            Response.Redirect("Receipt.aspx");
        }

        protected void submit_Click(object sender, EventArgs e)
        {
            this.PaymentAction= PaymentActionCodeType.Sale ;//(PaymentActionCodeType)Enum.Parse(typeof(PaymentActionCodeType), this.Request.QueryString[Constants.PAYMENT_ACTION_PARAM]);
            Response.Redirect("ReviewOrder.aspx?" + Constants.PAYMENT_AMOUNT_PARAM + "=" + paymentAmount.Text + "&" + Constants.PAYMENT_CURRENCY_PARAM + "=" + this.currencyCodeType.SelectedValue);
        }


       
    }
}
